package com.me.libgdx_test;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Image;

public class ClassActorFactory extends Actor{
	private Sprite sprite = new Sprite();
	private String name, description;
	private int index;
	//This class will create a bunch of actors for the selection screen when given sprites and coordinates
	ClassActorFactory(Sprite sprite,Point location, Point dimension, String name, String description, int index){
		this.name = name;
		this.description = description;
		setPosition(location.x, location.y);
		setSize(dimension.x, dimension.y);
		this.sprite.set(sprite);
		this.sprite.setPosition(location.x, location.y);
		this.sprite.setSize(dimension.x, dimension.y);
		this.index = index;
	}
	@Override
	public void draw (SpriteBatch batch, float parentAlpha) {
		sprite.draw(batch);
	}
	public Sprite get_sprite(){
		return sprite;
	}
	public String get_name(){
		return name;
	}
	public String get_description(){
		return description;
	}
	public int get_index(){
		return index;
	}
	public Image set_completed_background(Sprite background, Sprite background_2, boolean completed){
		
		Color back_color = new Color();
		Sprite background_sprite;
		
		if(completed){
			background_sprite = new Sprite(background_2);
			back_color.set(0, 1, 0, (float) .5);
		}else{
			background_sprite = new Sprite(background);
			back_color.set(1, 0, 0, (float) 1);
		}
		Image image = new Image(background_sprite);
		image.setPosition(sprite.getX(), sprite.getY());
		image.setSize(sprite.getWidth(), sprite.getHeight());
		image.setColor(back_color);
		if(completed){
			//Sets the alpha to 0 for completed class backgrounds. 
			//Just doing this until I can figure out something better
			image.setColor(0,0,0,0);
		}
		
		
		return image;
	}
	//Need to override the fire function here to put the actor in the preview window when clicked
}
